#ifndef __graph_H__
#define __graph_H__

#define Default_Vertex_Size 10 //默认顶点数
#define datatype char
#define type_weight int	    //权值类型
#define MAX_COST 0x7FFFFFFF //有符号下的最大值

typedef struct Edge
{
	int x;    //start
	int y;    //end
	type_weight cost;
}Edge;

typedef struct Graph
{
	int MaxVertex;
	int NumVertex;
	int NumEdge;
	datatype *VertexList;
	int **Edge;
} Graph;

int Init(Graph *);
void Show(Graph *graph);
int InsertVertex(Graph *graph, datatype vertex);
int InsertEdge(Graph *graph, datatype vertex1, datatype vertex2, type_weight cost);
int GetVertexPosition(Graph *graph, datatype vertex);
int RemoveVertex1(Graph *graph, datatype vertex); //删除顶点方法1：删除顶点的后续顶点前移一位
int RemoveVertex2(Graph *graph, datatype vertex); //删除顶点方法2：末尾顶点顶替删除顶点的位置
int RemoveEdge(Graph *graph, datatype vertex1, datatype vertex2);
void DestoryGraph(Graph *graph);
int GetFirstNeighbor(Graph *graph, datatype vertex);
int GetNextNeighbor(Graph *graph, datatype vertex1, datatype vertex2);
//==================================================================================
int ShortestPath(Graph *graph,char vertex);
#endif
